package com.jeasy.web.controllers.index;

import com.jeasy.web.controllers.common.BaseController;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 入口Controller
 * <p>
 * com.jeasy.web.controllers.IndexController.java
 * <p>
 * Created by Wang on 2017/8/31.
 */
@Controller
@RequestMapping("/*")
@SuppressWarnings("all")
public class IndexController extends BaseController {

    /**
     * Describle 跳转至首页
     * Throws IOException
     */
    @RequestMapping(value = "/index.html", method = { RequestMethod.POST, RequestMethod.GET })
    public ModelAndView indexView(HttpServletRequest request, HttpServletResponse response) {

        // 返回对象
        ModelAndView view = new ModelAndView();

        try {

            // 返回视图
            view.setViewName("common/index");

        } catch (Exception ex) {

            logger.error("跳转到首页出现异常", ex);
        }

        return view;
    }
}
